/**
 * @author Just、倾城
 * @created 2025-11-04
 * @description
 *
 */
public class TaxiContext {
    private PricingStrategy strategy;
    public void setStrategy(PricingStrategy strategy) {
        this.strategy = strategy;
    }
    public double calculateFare(double distance) {
        if(strategy == null){
            throw new IllegalStateException("No pricing strategy set.");
        }

        return strategy.calculatePrice(distance);
    }
}
